from tortoise import BaseDBAsyncClient


async def upgrade(db: BaseDBAsyncClient) -> str:
    return """
        CREATE TABLE IF NOT EXISTS `user` (
    `id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `name` VARCHAR(32) NOT NULL COMMENT '姓名',
    `num` VARCHAR(10) NOT NULL UNIQUE COMMENT '账号',
    `sf` VARCHAR(10) NOT NULL DEFAULT 'student'
) CHARACTER SET utf8mb4;
        DROP TABLE IF EXISTS `vver_code`;"""


async def downgrade(db: BaseDBAsyncClient) -> str:
    return """
        DROP TABLE IF EXISTS `user`;"""
